package ar.com.ctrln.services.insumo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ar.com.ctrln.persistence.dao.insumo.InsumoDao;
import ar.com.ctrln.persistence.dao.proveedor.ProveedorDao;
import ar.com.ctrln.persistence.model.insumo.Insumo;
import ar.com.ctrln.persistence.model.proveedor.Proveedor;

@Service("gestorInsumo")
public class GestorInsumo {

	@Autowired
	private InsumoDao insumoDao;
	
	@Autowired
	private ProveedorDao proveedorDao;

		
	public void guardarInsumo(Insumo insumo){
		insumoDao.save(insumo);
	}
	
	public void actualizarInsumo(Insumo insumo){
		insumoDao.update(insumo);
	}
	
	public List<Insumo> listaInsumos(){
		final List<Insumo> list = insumoDao.getList();
		return list;
	}
	
	public List<Insumo> listarInsumosxTipo(String tipo) {

		return insumoDao.insumosByTipo(tipo);
	}
	
	public List<Proveedor> listaProveedor(){
		final List<Proveedor> list = proveedorDao.getList();
		return list;
	}
}

